package spring.cloud.simple.ui.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import spring.cloud.simple.ui.model.User;
import spring.cloud.simple.ui.service.FeignUserService;

@RestController
public class FeignUserController {
    @Autowired
    private FeignUserService feignUserService;

    @RequestMapping(value = "/feign-users", method = {RequestMethod.GET})
    public ResponseEntity<List<User>> findAll() {
        List<User> users = feignUserService.findAll();
        return new ResponseEntity<>(users, HttpStatus.OK);
    }
}
